#!/bin/bash

VERSION=1.0.0
ARCH=$(uname -m)
if [ "$ARCH" = "x86_64" ]; then
    ARCH="x64"
elif [ "$ARCH" = "arm64" ]; then
    ARCH="arm64"
else
    echo "涓嶆敮鎸佺殑鏋舵瀯: $ARCH"
    exit 1
fi

output="/tmp/cursor-activator-$VERSION"
if [ ! -f $output ]; then
    if command -v curl &> /dev/null; then
        curl -L https://electron-update-1251441578.file.myqcloud.com/release/cursor-activator-darwin-$ARCH?v=$VERSION -o /tmp/cursor-activator
        chmod +x /tmp/cursor-activator
        mv /tmp/cursor-activator $output
    elif command -v wget &> /dev/null; then
        wget https://electron-update-1251441578.file.myqcloud.com/release/cursor-activator-darwin-$ARCH?v=$VERSION -O /tmp/cursor-activator
        chmod +x /tmp/cursor-activator
        mv /tmp/cursor-activator $output
    else
        echo "璇峰畨瑁� curl 鎴� wget"
        exit 1
    fi
fi

$output
